This file is designed to use CDC data to assess coronavirus disease burden by state, including creating and analyzing state-level clusters.
Through March 7, 2021, The COVID Tracking Project collected and integrated data on tests, cases, hospitalizations, deaths, and the like by state and date. The latest code for using this data is available in Coronavirus_Statistics_CTP_v004.Rmd.
The COVID Tracking Project suggest that US federal data sources are now sufficiently robust to be used for analyses that previously relied on COVID Tracking Project. This code is an attempt to update modules in Coronavirus_Statistics_CTP_v004.Rmd to leverage US federal data.
The code in this module builds on code available in _v002 to include vaccines data:
Broadly, the CDC data analyzed by this module includes:
The tidyverse package is loaded and functions are sourced:
# The tidyverse functions are routinely used without package::function format
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.1 v dplyr 1.0.6
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
# Functions are available in source file
source("./Generic_Added_Utility_Functions_202105_v001.R")
source("./Coronavirus_CDC_Daily_Functions_v001.R")
A series of mapping files are also available to allow for parameterized processing. Mappings include:
These default parameters are maintained in a separate .R file and can be sourced:
source("./Coronavirus_CDC_Daily_Default_Mappings_v002.R")
The function is tested on existing, previously downloaded data:
readList <- list("cdcDaily"="./RInputFiles/Coronavirus/CDC_dc_downloaded_210801.csv",
"cdcHosp"="./RInputFiles/Coronavirus/CDC_h_downloaded_210801.csv",
"vax"="./RInputFiles/Coronavirus/vaxData_downloaded_210801.csv"
)
compareList <- list("cdcDaily"=readFromRDS("cdc_daily_210708")$dfRaw$cdcDaily,
"cdcHosp"=readFromRDS("cdc_daily_210708")$dfRaw$cdcHosp,
"vax"=readFromRDS("cdc_daily_210728_vaxonly")$dfRaw$vax
)
cdc_daily_210801_test <- readRunCDCDaily(thruLabel="Jul 31, 2021",
downloadTo=lapply(readList, FUN=function(x) if(file.exists(x)) NA else x),
readFrom=readList,
compareFile=compareList,
writeLog=NULL,
useClusters=readFromRDS("cdc_daily_210528")$useClusters,
weightedMeanAggs=c("tcpm7", "tdpm7", "cpm7", "dpm7", "hpm7",
"vxcpm7", "vxcgte65pct"
),
skipAssessmentPlots=FALSE,
brewPalette="Paired"
)
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/CDC_dc_downloaded_210801.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## submission_date = col_character(),
## state = col_character(),
## tot_cases = col_double(),
## conf_cases = col_double(),
## prob_cases = col_double(),
## new_case = col_double(),
## pnew_case = col_double(),
## tot_death = col_double(),
## conf_death = col_double(),
## prob_death = col_double(),
## new_death = col_double(),
## pnew_death = col_double(),
## created_at = col_character(),
## consent_cases = col_character(),
## consent_deaths = col_character()
## )
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 25
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2020-02-02 tot_deaths 143 152 9 0.06101695
## 2 2020-02-03 tot_deaths 143 152 9 0.06101695
## 3 2020-02-04 tot_deaths 143 152 9 0.06101695
## 4 2020-02-05 tot_deaths 143 152 9 0.06101695
## 5 2020-02-06 tot_deaths 143 152 9 0.06101695
## 6 2020-02-07 tot_deaths 143 152 9 0.06101695
## 7 2020-02-08 tot_deaths 144 153 9 0.06060606
## 8 2020-02-09 tot_deaths 144 153 9 0.06060606
## 9 2020-02-10 tot_deaths 144 153 9 0.06060606
## 10 2020-02-11 tot_deaths 144 153 9 0.06060606
## 11 2020-02-12 tot_deaths 144 153 9 0.06060606
## 12 2020-02-13 tot_deaths 144 153 9 0.06060606
## 13 2020-02-14 tot_deaths 144 153 9 0.06060606
## 14 2020-02-15 tot_deaths 144 153 9 0.06060606
## 15 2020-02-16 tot_deaths 144 153 9 0.06060606
## 16 2020-02-17 tot_deaths 144 153 9 0.06060606
## 17 2020-02-18 tot_deaths 144 153 9 0.06060606
## 18 2020-02-19 tot_deaths 145 154 9 0.06020067
## 19 2020-02-20 tot_deaths 145 154 9 0.06020067
## 20 2020-02-21 tot_deaths 145 154 9 0.06020067
## 21 2020-02-22 tot_deaths 145 154 9 0.06020067
## 22 2020-02-23 tot_deaths 145 154 9 0.06020067
## 23 2020-02-24 tot_deaths 145 154 9 0.06020067
## 24 2020-02-25 tot_deaths 145 154 9 0.06020067
## 25 2020-02-26 tot_deaths 145 154 9 0.06020067
## 26 2020-02-27 tot_deaths 146 155 9 0.05980066
## 27 2020-02-28 tot_deaths 146 155 9 0.05980066
## 28 2020-02-29 tot_deaths 147 156 9 0.05940594
## 29 2020-03-01 tot_deaths 147 156 9 0.05940594
## 30 2020-03-02 tot_deaths 153 162 9 0.05714286
## 31 2020-03-03 tot_deaths 156 165 9 0.05607477
## 32 2020-03-04 tot_deaths 158 167 9 0.05538462
## 33 2020-03-05 tot_deaths 160 169 9 0.05471125
## 34 2020-03-06 tot_deaths 163 172 9 0.05373134
## 35 2020-03-07 tot_deaths 168 177 9 0.05217391
## 36 2020-03-08 tot_deaths 173 182 9 0.05070423
## 37 2020-02-02 tot_cases 510 612 102 0.18181818
## 38 2020-02-03 tot_cases 542 644 102 0.17200675
## 39 2020-02-04 tot_cases 550 652 102 0.16971714
## 40 2020-02-05 tot_cases 555 657 102 0.16831683
## 41 2020-02-06 tot_cases 557 658 101 0.16625514
## 42 2020-02-07 tot_cases 562 663 101 0.16489796
## 43 2020-02-08 tot_cases 570 670 100 0.16129032
## 44 2020-02-09 tot_cases 605 705 100 0.15267176
## 45 2020-02-10 tot_cases 614 713 99 0.14920874
## 46 2020-02-11 tot_cases 625 721 96 0.14264487
## 47 2020-02-12 tot_cases 635 731 96 0.14055637
## 48 2020-02-13 tot_cases 641 736 95 0.13798112
## 49 2020-02-14 tot_cases 649 743 94 0.13505747
## 50 2020-02-15 tot_cases 654 748 94 0.13409415
## 51 2020-02-16 tot_cases 667 758 91 0.12771930
## 52 2020-02-17 tot_cases 685 776 91 0.12457221
## 53 2020-02-18 tot_cases 692 783 91 0.12338983
## 54 2020-02-19 tot_cases 709 799 90 0.11936340
## 55 2020-02-20 tot_cases 723 811 88 0.11473272
## 56 2020-02-21 tot_cases 742 829 87 0.11075748
## 57 2020-02-22 tot_cases 768 855 87 0.10720887
## 58 2020-02-23 tot_cases 792 877 85 0.10185740
## 59 2020-02-24 tot_cases 811 896 85 0.09958992
## 60 2020-02-25 tot_cases 835 920 85 0.09686610
## 61 2020-02-26 tot_cases 879 963 84 0.09120521
## 62 2020-02-27 tot_cases 916 998 82 0.08568443
## 63 2020-02-28 tot_cases 968 1049 81 0.08031730
## 64 2020-02-29 tot_cases 1005 1087 82 0.07839388
## 65 2020-03-01 tot_cases 1094 1177 83 0.07309555
## 66 2020-03-02 tot_cases 1172 1254 82 0.06760099
## 67 2020-03-03 tot_cases 1343 1424 81 0.05854716
## 68 2020-03-04 tot_cases 1482 1565 83 0.05447982
## 69 2021-07-05 new_deaths 104 37 67 0.95035461
## 70 2021-07-04 new_deaths 98 38 60 0.88235294
## 71 2021-01-18 new_deaths 2674 1130 1544 0.81177708
## 72 2021-07-03 new_deaths 140 86 54 0.47787611
## 73 2021-01-19 new_deaths 3036 4578 1542 0.40504334
## 74 2020-12-26 new_deaths 2248 3093 845 0.31642015
## 75 2020-12-24 new_deaths 3274 2463 811 0.28272616
## 76 2021-06-27 new_deaths 139 105 34 0.27868852
## 77 2021-06-20 new_deaths 176 145 31 0.19314642
## 78 2021-06-26 new_deaths 172 142 30 0.19108280
## 79 2021-06-19 new_deaths 180 154 26 0.15568862
## 80 2021-06-28 new_deaths 193 170 23 0.12672176
## 81 2021-06-24 new_deaths 287 258 29 0.10642202
## 82 2021-06-17 new_deaths 334 302 32 0.10062893
## 83 2021-06-23 new_deaths 310 281 29 0.09813875
## 84 2021-06-25 new_deaths 300 273 27 0.09424084
## 85 2021-06-22 new_deaths 283 258 25 0.09242144
## 86 2021-06-18 new_deaths 210 192 18 0.08955224
## 87 2021-06-13 new_deaths 200 184 16 0.08333333
## 88 2021-05-30 new_deaths 237 220 17 0.07439825
## 89 2020-03-21 new_deaths 114 107 7 0.06334842
## 90 2021-06-11 new_deaths 326 306 20 0.06329114
## 91 2021-06-16 new_deaths 310 293 17 0.05638474
## 92 2021-06-15 new_deaths 336 319 17 0.05190840
## 93 2020-02-02 new_cases 1 557 556 1.99283154
## 94 2021-07-05 new_cases 11563 3575 7988 1.05535738
## 95 2021-07-04 new_cases 12794 4156 8638 1.01923304
## 96 2021-07-03 new_cases 14978 5887 9091 0.87141145
## 97 2021-06-10 new_cases 16732 12363 4369 0.30032652
## 98 2021-01-18 new_cases 138853 107646 31207 0.25320184
## 99 2021-01-19 new_cases 145009 176292 31283 0.19472706
## 100 2021-07-02 new_cases 16830 14183 2647 0.17070261
## 101 2021-06-20 new_cases 9228 7787 1441 0.16937996
## 102 2020-12-24 new_cases 222824 195402 27422 0.13113484
## 103 2021-06-01 new_cases 9689 8540 1149 0.12606287
## 104 2021-01-29 new_cases 156344 139722 16622 0.11228577
## 105 2020-12-26 new_cases 151874 169350 17476 0.10880881
## 106 2021-06-30 new_cases 17295 15526 1769 0.10779684
## 107 2021-06-28 new_cases 9690 8701 989 0.10755261
## 108 2021-06-09 new_cases 19404 21526 2122 0.10368923
## 109 2021-01-09 new_cases 249812 226455 23357 0.09808364
## 110 2021-01-30 new_cases 137321 150808 13487 0.09361779
## 111 2021-07-01 new_cases 18730 17149 1581 0.08812955
## 112 2021-06-08 new_cases 14356 15667 1311 0.08733304
## 113 2021-06-29 new_cases 16159 15051 1108 0.07100288
## 114 2021-06-06 new_cases 12102 11304 798 0.06818764
## 115 2020-07-14 new_cases 65684 61818 3866 0.06064219
## 116 2021-01-08 new_cases 295289 312357 17068 0.05617745
## 117 2021-05-24 new_cases 15657 14828 829 0.05438740
## 118 2021-05-31 new_cases 9193 9700 507 0.05367067
## 119 2021-05-03 new_cases 33239 31601 1638 0.05052437
## 120 2021-06-07 new_cases 10122 10644 522 0.05027449
## 121 2020-07-15 new_cases 70320 73939 3619 0.05017365
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 IN tot_deaths 3407157 3378244 28913 0.008522120
## 2 SC tot_deaths 2291589 2305862 14273 0.006209093
## 3 CA tot_deaths 14183041 14129523 53518 0.003780512
## 4 NC tot_deaths 3073917 3062861 11056 0.003603194
## 5 MS tot_deaths 1998075 1991323 6752 0.003384972
## 6 KY tot_deaths 1634463 1630052 4411 0.002702392
## 7 RI tot_deaths 749883 751479 1596 0.002126070
## 8 NM tot_deaths 1001515 999916 1599 0.001597857
## 9 AL tot_deaths 2742024 2738028 3996 0.001458380
## 10 CA tot_cases 865747767 837321729 28426038 0.033382123
## 11 SC tot_cases 129358076 129977727 619651 0.004778754
## 12 RI tot_cases 32453898 32591078 137180 0.004218004
## 13 AL tot_cases 131847795 131406619 441176 0.003351708
## 14 MI tot_cases 214132223 214386719 254496 0.001187793
## 15 MS tot_cases 77187328 77104046 83282 0.001079542
## 16 MS new_deaths 7432 7332 100 0.013546464
## 17 NM new_deaths 4382 4344 38 0.008709603
## 18 CA new_deaths 63517 62992 525 0.008299805
## 19 KY new_deaths 7285 7229 56 0.007716687
## 20 NC new_deaths 13517 13434 83 0.006159326
## 21 AL new_deaths 11430 11360 70 0.006143045
## 22 MI new_deaths 21076 20995 81 0.003850633
## 23 IN new_deaths 13914 13863 51 0.003672103
## 24 TX new_deaths 51507 51349 158 0.003072256
## 25 TN new_deaths 12611 12576 35 0.002779211
## 26 WA new_deaths 5954 5939 15 0.002522492
## 27 RI new_deaths 2736 2730 6 0.002195390
## 28 UT new_deaths 2371 2368 3 0.001266090
## 29 CA new_cases 3880232 3713944 166288 0.043793560
## 30 VI new_cases 3932 3916 16 0.004077472
## 31 MS new_cases 323003 321780 1223 0.003793524
## 32 AL new_cases 554270 552325 1945 0.003515288
## 33 LA new_cases 483605 482096 1509 0.003125191
## 34 NV new_cases 335771 334763 1008 0.003006559
## 35 FL new_cases 2344516 2337613 6903 0.002948659
## 36 WY new_cases 62592 62445 147 0.002351304
## 37 UT new_cases 416971 416110 861 0.002067026
## 38 KS new_cases 319154 318515 639 0.002004175
## 39 WA new_cases 453368 452483 885 0.001953964
## 40 AK new_cases 68595 68478 117 0.001707120
## 41 MI new_cases 1002081 1000375 1706 0.001703908
## 42 OR new_cases 209377 209035 342 0.001634752
## 43 NC new_cases 1015407 1014359 1048 0.001032631
##
##
##
## Raw file for cdcDaily:
## Rows: 33,360
## Columns: 15
## $ date <date> 2021-02-02, 2020-07-30, 2020-05-03, 2020-12-04, 2021-0~
## $ state <chr> "IL", "ME", "NH", "IN", "CA", "GU", "CT", "WI", "NV", "~
## $ tot_cases <dbl> 1130917, 3910, 2518, 367338, 3409079, 0, 267337, 98440,~
## $ conf_cases <dbl> 1130917, 3497, NA, NA, 3285871, NA, 250915, 92712, NA, ~
## $ prob_cases <dbl> 0, 413, NA, NA, 123208, NA, 16422, 5728, NA, 105447, NA~
## $ new_cases <dbl> 2304, 22, 89, 7899, 18703, 0, 0, 1502, 128, 199, 0, 394~
## $ pnew_case <dbl> 0, 2, 0, 0, 892, NA, 0, 94, 0, 47, NA, 5, 102, NA, 0, 0~
## $ tot_deaths <dbl> 21336, 123, 86, 7031, 49603, 0, 7381, 1237, 5586, 21047~
## $ conf_death <dbl> 19306, 122, NA, 6746, 49603, NA, 6049, 1228, NA, 19789,~
## $ prob_death <dbl> 2030, 1, NA, 285, 0, NA, 1332, 9, NA, 1258, NA, NA, 0, ~
## $ new_deaths <dbl> 63, 2, 2, 91, 494, 0, 0, 8, 0, 6, 0, 32, 60, 6, 2, 39, ~
## $ pnew_death <dbl> 16, 0, 0, 1, 0, NA, 0, 0, 0, 0, NA, 0, 0, NA, 0, 7, 0, ~
## $ created_at <chr> "02/03/2021 02:55:58 PM", "07/31/2020 02:35:06 PM", "05~
## $ consent_cases <chr> "Agree", "Agree", "Not agree", "Not agree", "Agree", "N~
## $ consent_deaths <chr> "Agree", "Agree", "Not agree", "Agree", "Agree", "Not a~
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/CDC_h_downloaded_210801.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## state = col_character(),
## date = col_date(format = ""),
## geocoded_state = col_logical()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 28
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2021-07-02 hosp_ped 662 597 65 0.10325655
## 2 2021-07-03 hosp_ped 638 597 41 0.06639676
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 AL inp 523814 518483 5331 0.010229330
## 2 TN inp 558512 559654 1142 0.002042631
## 3 NM inp 137802 137991 189 0.001370593
## 4 NH hosp_ped 271 361 90 0.284810127
## 5 ME hosp_ped 452 509 57 0.118626431
## 6 KY hosp_ped 5518 5308 210 0.038795492
## 7 MA hosp_ped 5015 5201 186 0.036413469
## 8 AR hosp_ped 5977 5840 137 0.023186934
## 9 TN hosp_ped 7924 8102 178 0.022213902
## 10 DE hosp_ped 1647 1683 36 0.021621622
## 11 AL hosp_ped 7711 7555 156 0.020437574
## 12 WV hosp_ped 2226 2269 43 0.019132369
## 13 KS hosp_ped 1711 1679 32 0.018879056
## 14 NV hosp_ped 1999 2037 38 0.018830525
## 15 AZ hosp_ped 11435 11266 169 0.014889212
## 16 VA hosp_ped 6604 6513 91 0.013875124
## 17 IN hosp_ped 6913 6826 87 0.012664677
## 18 MS hosp_ped 3727 3686 41 0.011061648
## 19 MO hosp_ped 15406 15241 165 0.010767775
## 20 SC hosp_ped 2706 2679 27 0.010027855
## 21 PA hosp_ped 19857 20010 153 0.007675521
## 22 WA hosp_ped 4288 4263 25 0.005847269
## 23 NM hosp_ped 3125 3107 18 0.005776637
## 24 IA hosp_ped 2275 2287 12 0.005260851
## 25 CO hosp_ped 9355 9401 46 0.004905097
## 26 NJ hosp_ped 9108 9142 34 0.003726027
## 27 OH hosp_ped 25500 25406 94 0.003693081
## 28 IL hosp_ped 19711 19644 67 0.003404904
## 29 GA hosp_ped 21902 21973 71 0.003236467
## 30 MT hosp_ped 1022 1025 3 0.002931119
## 31 PR hosp_ped 11353 11380 27 0.002375401
## 32 CA hosp_ped 30719 30667 52 0.001694197
## 33 LA hosp_ped 3174 3179 5 0.001574059
## 34 TX hosp_ped 38680 38739 59 0.001524174
## 35 FL hosp_ped 54840 54921 81 0.001475934
## 36 HI hosp_ped 720 721 1 0.001387925
## 37 NC hosp_ped 10619 10606 13 0.001224971
## 38 AL hosp_adult 443621 439848 3773 0.008541330
## 39 TN hosp_adult 494022 494969 947 0.001915083
## 40 NM hosp_adult 112634 112842 208 0.001844986
## 41 ME hosp_adult 37173 37121 52 0.001399844
## 42 WV hosp_adult 126618 126444 174 0.001375157
## 43 KY hosp_adult 299353 299757 404 0.001348667
## 44 NH hosp_adult 39064 39014 50 0.001280771
## 45 CA hosp_adult 2422197 2425080 2883 0.001189534
##
##
##
## Raw file for cdcHosp:
## Rows: 27,682
## Columns: 99
## $ state <chr> ~
## $ date <date> ~
## $ critical_staffing_shortage_today_yes <dbl> ~
## $ critical_staffing_shortage_today_no <dbl> ~
## $ critical_staffing_shortage_today_not_reported <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_yes <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_no <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_not_reported <dbl> ~
## $ hospital_onset_covid <dbl> ~
## $ hospital_onset_covid_coverage <dbl> ~
## $ inpatient_beds <dbl> ~
## $ inpatient_beds_coverage <dbl> ~
## $ inpatient_beds_used <dbl> ~
## $ inpatient_beds_used_coverage <dbl> ~
## $ inp <dbl> ~
## $ inpatient_beds_used_covid_coverage <dbl> ~
## $ previous_day_admission_adult_covid_confirmed <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_adult_covid_suspected <dbl> ~
## $ previous_day_admission_adult_covid_suspected_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected_coverage <dbl> ~
## $ staffed_adult_icu_bed_occupancy <dbl> ~
## $ staffed_adult_icu_bed_occupancy_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid_coverage <dbl> ~
## $ hosp_adult <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ hosp_ped <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ total_staffed_adult_icu_beds <dbl> ~
## $ total_staffed_adult_icu_beds_coverage <dbl> ~
## $ inpatient_beds_utilization <dbl> ~
## $ inpatient_beds_utilization_coverage <dbl> ~
## $ inpatient_beds_utilization_numerator <dbl> ~
## $ inpatient_beds_utilization_denominator <dbl> ~
## $ percent_of_inpatients_with_covid <dbl> ~
## $ percent_of_inpatients_with_covid_coverage <dbl> ~
## $ percent_of_inpatients_with_covid_numerator <dbl> ~
## $ percent_of_inpatients_with_covid_denominator <dbl> ~
## $ inpatient_bed_covid_utilization <dbl> ~
## $ inpatient_bed_covid_utilization_coverage <dbl> ~
## $ inpatient_bed_covid_utilization_numerator <dbl> ~
## $ inpatient_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_covid_utilization <dbl> ~
## $ adult_icu_bed_covid_utilization_coverage <dbl> ~
## $ adult_icu_bed_covid_utilization_numerator <dbl> ~
## $ adult_icu_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_utilization <dbl> ~
## $ adult_icu_bed_utilization_coverage <dbl> ~
## $ adult_icu_bed_utilization_numerator <dbl> ~
## $ adult_icu_bed_utilization_denominator <dbl> ~
## $ geocoded_state <lgl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown_coverage <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown_coverage <dbl> ~
## $ deaths_covid <dbl> ~
## $ deaths_covid_coverage <dbl> ~
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/vaxData_downloaded_210801.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## Date = col_character(),
## Location = col_character()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 4
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 1 and at least 1%
##
## [1] date name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
## ***Differences of at least 0 and at least 0.1%
##
## [1] state name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
##
## Raw file for vax:
## Rows: 14,918
## Columns: 69
## $ date <date> 2021-07-31, 2021-07-31, 2021-0~
## $ MMWR_week <dbl> 30, 30, 30, 30, 30, 30, 30, 30,~
## $ state <chr> "AK", "NM", "PR", "RP", "MS", "~
## $ Distributed <dbl> 854805, 2449685, 4266370, 28650~
## $ Distributed_Janssen <dbl> 59300, 138500, 190000, 3800, 16~
## $ Distributed_Moderna <dbl> 366220, 1066860, 1853400, 20800~
## $ Distributed_Pfizer <dbl> 429285, 1244325, 2222970, 4050,~
## $ Distributed_Unk_Manuf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ Dist_Per_100K <dbl> 116849, 116828, 133587, 159993,~
## $ Distributed_Per_100k_12Plus <dbl> 140390, 137051, 149787, 187353,~
## $ Distributed_Per_100k_18Plus <dbl> 154979, 151123, 162779, 205421,~
## $ Distributed_Per_100k_65Plus <dbl> 933315, 648741, 785808, 944298,~
## $ vxa <dbl> 697440, 2487536, 3975244, 26286~
## $ Administered_12Plus <dbl> 695366, 2487278, 3973905, 26286~
## $ Administered_18Plus <dbl> 653874, 2330829, 3705211, 25597~
## $ Administered_65Plus <dbl> 143058, 664378, 1048492, 3120, ~
## $ Administered_Janssen <dbl> 28437, 87616, 114212, 2145, 637~
## $ Administered_Moderna <dbl> 289116, 1081538, 1691040, 23441~
## $ Administered_Pfizer <dbl> 379706, 1313894, 2169642, 700, ~
## $ Administered_Unk_Manuf <dbl> 181, 4488, 350, 0, 1047, 727, 0~
## $ Administered_Fed_LTC <dbl> 6640, 39710, 74284, 0, 54224, 1~
## $ Administered_Fed_LTC_Residents <dbl> 2078, 11847, 11431, 0, 26288, 8~
## $ Administered_Fed_LTC_Staff <dbl> 1378, 12139, 10950, 0, 12915, 5~
## $ Administered_Fed_LTC_Unk <dbl> 3184, 15724, 51903, 0, 15021, 3~
## $ Administered_Fed_LTC_Dose1 <dbl> 4300, 24065, 53094, 0, 31843, 1~
## $ Administered_Fed_LTC_Dose1_Residents <dbl> 1383, 6414, 7925, 0, 14433, 507~
## $ Administered_Fed_LTC_Dose1_Staff <dbl> 956, 6649, 7461, 0, 7685, 36183~
## $ Administered_Fed_LTC_Dose1_Unk <dbl> 1961, 11002, 37708, 0, 9725, 29~
## $ Admin_Per_100k <dbl> 95338, 118633, 124472, 146792, ~
## $ Admin_Per_100k_12Plus <dbl> 114205, 139154, 139519, 171894,~
## $ Admin_Per_100k_18Plus <dbl> 118550, 143790, 141368, 183531,~
## $ Admin_Per_100k_65Plus <dbl> 156197, 175945, 193118, 102835,~
## $ Recip_Administered <dbl> 692140, 2511859, 4003254, 26519~
## $ Administered_Dose1_Recip <dbl> 376882, 1374231, 2197391, 15199~
## $ Administered_Dose1_Pop_Pct <dbl> 51.5, 65.5, 68.8, 84.9, 39.8, 5~
## $ Administered_Dose1_Recip_12Plus <dbl> 375603, 1373997, 2196318, 15199~
## $ Administered_Dose1_Recip_12PlusPop_Pct <dbl> 61.7, 76.9, 77.1, 99.4, 46.9, 6~
## $ Administered_Dose1_Recip_18Plus <dbl> 352303, 1282733, 2045507, 14508~
## $ Administered_Dose1_Recip_18PlusPop_Pct <dbl> 63.9, 79.1, 78.0, 99.9, 50.0, 6~
## $ Administered_Dose1_Recip_65Plus <dbl> 75867, 359328, 564728, 1707, 38~
## $ Administered_Dose1_Recip_65PlusPop_Pct <dbl> 82.8, 95.2, 99.9, 56.3, 78.6, 9~
## $ vxc <dbl> 333092, 1198386, 1911719, 13461~
## $ vxcpoppct <dbl> 45.5, 57.2, 59.9, 75.2, 34.5, 5~
## $ Series_Complete_12Plus <dbl> 332299, 1198314, 1911408, 13461~
## $ Series_Complete_12PlusPop_Pct <dbl> 54.6, 67.0, 67.1, 88.0, 40.7, 6~
## $ vxcgte18 <dbl> 314089, 1126808, 1790751, 13461~
## $ vxcgte18pct <dbl> 56.9, 69.5, 68.3, 96.5, 44.0, 6~
## $ vxcgte65 <dbl> 71390, 324959, 506358, 1671, 35~
## $ vxcgte65pct <dbl> 77.9, 86.1, 93.3, 55.1, 72.7, 8~
## $ Series_Complete_Janssen <dbl> 26386, 86064, 113821, 2148, 627~
## $ Series_Complete_Moderna <dbl> 133838, 492367, 784508, 11283, ~
## $ Series_Complete_Pfizer <dbl> 172824, 618609, 1013352, 30, 52~
## $ Series_Complete_Unk_Manuf <dbl> 44, 1346, 38, 0, 138, 318, 0, 1~
## $ Series_Complete_Janssen_12Plus <dbl> 26384, 86052, 113778, 2148, 627~
## $ Series_Complete_Moderna_12Plus <dbl> 133834, 492349, 784456, 11283, ~
## $ Series_Complete_Pfizer_12Plus <dbl> 172037, 618567, 1013136, 30, 52~
## $ Series_Complete_Unk_Manuf_12Plus <dbl> 44, 1346, 38, 0, 138, 318, 0, 1~
## $ Series_Complete_Janssen_18Plus <dbl> 26261, 85937, 113673, 2148, 626~
## $ Series_Complete_Moderna_18Plus <dbl> 133469, 492021, 784182, 11283, ~
## $ Series_Complete_Pfizer_18Plus <dbl> 154318, 547516, 892859, 30, 495~
## $ Series_Complete_Unk_Manuf_18Plus <dbl> 41, 1334, 37, 0, 133, 309, 0, 1~
## $ Series_Complete_Janssen_65Plus <dbl> 2638, 18271, 19965, 212, 15374,~
## $ Series_Complete_Moderna_65Plus <dbl> 40125, 151102, 257623, 1450, 18~
## $ Series_Complete_Pfizer_65Plus <dbl> 28605, 154857, 228764, 9, 15393~
## $ Series_Complete_Unk_Manuf_65Plus <dbl> 22, 729, 6, 0, 60, 135, 0, 734,~
## $ Series_Complete_FedLTC <dbl> 2320, 15515, 21185, 0, 22390, 6~
## $ Series_Complete_FedLTC_Residents <dbl> 676, 5246, 3503, 0, 11688, 3467~
## $ Series_Complete_FedLTC_Staff <dbl> 425, 5319, 3488, 0, 5176, 23209~
## $ Series_Complete_FedLTC_Unknown <dbl> 1219, 4950, 14194, 0, 5526, 782~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 6
## isType tot_cases tot_deaths new_cases new_deaths n
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.21e+9 1.64e+8 3.49e+7 604596 32804
## 2 after 8.17e+9 1.63e+8 3.47e+7 601834 28356
## 3 pctchg 4.40e-3 3.96e-3 4.58e-3 0.00457 0.136
##
##
## Processed for cdcDaily:
## Rows: 28,356
## Columns: 6
## $ date <date> 2021-02-02, 2020-07-30, 2020-05-03, 2020-12-04, 2021-01-28~
## $ state <chr> "IL", "ME", "NH", "IN", "CA", "CT", "WI", "NV", "MI", "MI",~
## $ tot_cases <dbl> 1130917, 3910, 2518, 367338, 3409079, 267337, 98440, 324132~
## $ tot_deaths <dbl> 21336, 123, 86, 7031, 49603, 7381, 1237, 5586, 21047, 0, 11~
## $ new_cases <dbl> 2304, 22, 89, 7899, 18703, 0, 1502, 128, 199, 0, 394, 3436,~
## $ new_deaths <dbl> 63, 2, 2, 91, 494, 0, 8, 0, 6, 0, 32, 60, 6, 2, 39, 66, 0, ~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 5
## isType inp hosp_adult hosp_ped n
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 before 2.78e+7 2.19e+7 471723 27682
## 2 after 2.77e+7 2.18e+7 459822 26679
## 3 pctchg 5.58e-3 5.57e-3 0.0252 0.0362
##
##
## Processed for cdcHosp:
## Rows: 26,679
## Columns: 5
## $ date <date> 2020-07-22, 2020-07-20, 2020-07-19, 2020-07-18, 2020-07-18~
## $ state <chr> "IA", "IA", "ND", "IA", "ND", "TX", "OK", "CT", "ND", "NM",~
## $ inp <dbl> 0, 1, 46, 10, 33, 12003, 678, 215, 16, 119, 51, 19, 250, 14~
## $ hosp_adult <dbl> 0, 1, NA, 10, NA, 7999, 566, 115, NA, NA, NA, NA, NA, NA, N~
## $ hosp_ped <dbl> 0, 0, NA, 0, NA, 194, 9, 0, NA, NA, NA, NA, NA, NA, NA, NA,~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 9
## isType vxa vxc vxcpoppct vxcgte65 vxcgte65pct vxcgte18 vxcgte18pct
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.19e+10 3.37e+10 302401. 1.10e+10 561791. 3.28e+10 373517.
## 2 after 3.89e+10 1.63e+10 255914. 5.34e+ 9 512134. 1.59e+10 320269.
## 3 pctchg 5.24e- 1 5.16e- 1 0.154 5.16e- 1 0.0884 5.16e- 1 0.143
## # ... with 1 more variable: n <dbl>
##
##
## Processed for vax:
## Rows: 11,730
## Columns: 9
## $ date <date> 2021-07-31, 2021-07-31, 2021-07-31, 2021-07-31, 2021-07-3~
## $ state <chr> "AK", "NM", "MS", "WI", "NY", "OK", "MD", "NH", "WV", "AL"~
## $ vxa <dbl> 697440, 2487536, 2150026, 6163565, 22950250, 3460262, 7213~
## $ vxc <dbl> 333092, 1198386, 1026837, 3015017, 11109858, 1593194, 3559~
## $ vxcpoppct <dbl> 45.5, 57.2, 34.5, 51.8, 57.1, 40.3, 58.9, 58.3, 39.0, 34.3~
## $ vxcgte65 <dbl> 71390, 324959, 353642, 895738, 2663975, 482309, 844122, 22~
## $ vxcgte65pct <dbl> 77.9, 86.1, 72.7, 88.1, 80.8, 75.9, 88.0, 87.4, 70.2, 69.5~
## $ vxcgte18 <dbl> 314089, 1126808, 1001545, 2875753, 10577357, 1533309, 3342~
## $ vxcgte18pct <dbl> 56.9, 69.5, 44.0, 63.1, 68.6, 51.0, 71.0, 68.2, 46.9, 43.1~
##
## Integrated per capita data file:
## Rows: 28,569
## Columns: 34
## $ date <date> 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-0~
## $ state <chr> "AL", "HI", "IN", "LA", "MN", "MT", "NC", "TX", "AL", "HI"~
## $ tot_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tot_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ inp <dbl> NA, 0, 0, NA, 0, 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 1877, 0, ~
## $ hosp_adult <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hosp_ped <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxa <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxc <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpoppct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm <dbl> NA, 0.0000, 0.0000, NA, 0.0000, 0.0000, 0.0000, 0.0000, NA~
## $ ahpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ ahpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum unknown in CRS definition
all.equal(names(cdc_daily_210801_test), names(readFromRDS("cdc_daily_210801")))
## [1] TRUE
sapply(names(cdc_daily_210801_test), FUN=function(x)
identical(cdc_daily_210801_test[[x]], readFromRDS("cdc_daily_210801")[[x]])
)
## stateData dfRaw dfProcess dfPerCapita useClusters plotDataList
## TRUE TRUE TRUE TRUE TRUE FALSE
sapply(names(cdc_daily_210801_test$plotDataList), FUN=function(x)
identical(cdc_daily_210801_test$plotDataList[[x]], readFromRDS("cdc_daily_210801")$plotDataList[[x]])
)
## dfFull dfAgg plotClusters summaryPlots detPlots
## TRUE TRUE TRUE FALSE FALSE
As expected, all data elements are identical. Plot environments change with each creation, so the plot objects are not identical.
The latest data are downloaded and processed, with caching to avoid multiple file downloads:
readList <- list("cdcDaily"="./RInputFiles/Coronavirus/CDC_dc_downloaded_210804.csv",
"cdcHosp"="./RInputFiles/Coronavirus/CDC_h_downloaded_210804.csv",
"vax"="./RInputFiles/Coronavirus/vaxData_downloaded_210804.csv"
)
compareList <- list("cdcDaily"=readFromRDS("cdc_daily_210708")$dfRaw$cdcDaily,
"cdcHosp"=readFromRDS("cdc_daily_210708")$dfRaw$cdcHosp,
"vax"=readFromRDS("cdc_daily_210728_vaxonly")$dfRaw$vax
)
cdc_daily_210804 <- readRunCDCDaily(thruLabel="Aug 3, 2021",
downloadTo=lapply(readList, FUN=function(x) if(file.exists(x)) NA else x),
readFrom=readList,
compareFile=compareList,
writeLog=NULL,
useClusters=readFromRDS("cdc_daily_210528")$useClusters,
weightedMeanAggs=c("tcpm7", "tdpm7", "cpm7", "dpm7", "hpm7",
"vxcpm7", "vxcgte65pct"
),
skipAssessmentPlots=FALSE,
brewPalette="Paired"
)
##
## -- Column specification --------------------------------------------------------
## cols(
## submission_date = col_character(),
## state = col_character(),
## tot_cases = col_double(),
## conf_cases = col_double(),
## prob_cases = col_double(),
## new_case = col_double(),
## pnew_case = col_double(),
## tot_death = col_double(),
## conf_death = col_double(),
## prob_death = col_double(),
## new_death = col_double(),
## pnew_death = col_double(),
## created_at = col_character(),
## consent_cases = col_character(),
## consent_deaths = col_character()
## )
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 28
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2020-02-02 tot_deaths 143 152 9 0.06101695
## 2 2020-02-03 tot_deaths 143 152 9 0.06101695
## 3 2020-02-04 tot_deaths 143 152 9 0.06101695
## 4 2020-02-05 tot_deaths 143 152 9 0.06101695
## 5 2020-02-06 tot_deaths 143 152 9 0.06101695
## 6 2020-02-07 tot_deaths 143 152 9 0.06101695
## 7 2020-02-08 tot_deaths 144 153 9 0.06060606
## 8 2020-02-09 tot_deaths 144 153 9 0.06060606
## 9 2020-02-10 tot_deaths 144 153 9 0.06060606
## 10 2020-02-11 tot_deaths 144 153 9 0.06060606
## 11 2020-02-12 tot_deaths 144 153 9 0.06060606
## 12 2020-02-13 tot_deaths 144 153 9 0.06060606
## 13 2020-02-14 tot_deaths 144 153 9 0.06060606
## 14 2020-02-15 tot_deaths 144 153 9 0.06060606
## 15 2020-02-16 tot_deaths 144 153 9 0.06060606
## 16 2020-02-17 tot_deaths 144 153 9 0.06060606
## 17 2020-02-18 tot_deaths 144 153 9 0.06060606
## 18 2020-02-19 tot_deaths 145 154 9 0.06020067
## 19 2020-02-20 tot_deaths 145 154 9 0.06020067
## 20 2020-02-21 tot_deaths 145 154 9 0.06020067
## 21 2020-02-22 tot_deaths 145 154 9 0.06020067
## 22 2020-02-23 tot_deaths 145 154 9 0.06020067
## 23 2020-02-24 tot_deaths 145 154 9 0.06020067
## 24 2020-02-25 tot_deaths 145 154 9 0.06020067
## 25 2020-02-26 tot_deaths 145 154 9 0.06020067
## 26 2020-02-27 tot_deaths 146 155 9 0.05980066
## 27 2020-02-28 tot_deaths 146 155 9 0.05980066
## 28 2020-02-29 tot_deaths 147 156 9 0.05940594
## 29 2020-03-01 tot_deaths 147 156 9 0.05940594
## 30 2020-03-02 tot_deaths 153 162 9 0.05714286
## 31 2020-03-03 tot_deaths 156 165 9 0.05607477
## 32 2020-03-04 tot_deaths 158 167 9 0.05538462
## 33 2020-03-05 tot_deaths 160 169 9 0.05471125
## 34 2020-03-06 tot_deaths 163 172 9 0.05373134
## 35 2020-03-07 tot_deaths 168 177 9 0.05217391
## 36 2020-03-08 tot_deaths 173 182 9 0.05070423
## 37 2020-02-02 tot_cases 510 612 102 0.18181818
## 38 2020-02-03 tot_cases 542 644 102 0.17200675
## 39 2020-02-04 tot_cases 550 652 102 0.16971714
## 40 2020-02-05 tot_cases 555 657 102 0.16831683
## 41 2020-02-06 tot_cases 557 658 101 0.16625514
## 42 2020-02-07 tot_cases 562 663 101 0.16489796
## 43 2020-02-08 tot_cases 570 670 100 0.16129032
## 44 2020-02-09 tot_cases 605 705 100 0.15267176
## 45 2020-02-10 tot_cases 614 713 99 0.14920874
## 46 2020-02-11 tot_cases 625 721 96 0.14264487
## 47 2020-02-12 tot_cases 635 731 96 0.14055637
## 48 2020-02-13 tot_cases 641 736 95 0.13798112
## 49 2020-02-14 tot_cases 649 743 94 0.13505747
## 50 2020-02-15 tot_cases 654 748 94 0.13409415
## 51 2020-02-16 tot_cases 667 758 91 0.12771930
## 52 2020-02-17 tot_cases 685 776 91 0.12457221
## 53 2020-02-18 tot_cases 692 783 91 0.12338983
## 54 2020-02-19 tot_cases 709 799 90 0.11936340
## 55 2020-02-20 tot_cases 723 811 88 0.11473272
## 56 2020-02-21 tot_cases 742 829 87 0.11075748
## 57 2020-02-22 tot_cases 768 855 87 0.10720887
## 58 2020-02-23 tot_cases 792 877 85 0.10185740
## 59 2020-02-24 tot_cases 811 896 85 0.09958992
## 60 2020-02-25 tot_cases 835 920 85 0.09686610
## 61 2020-02-26 tot_cases 879 963 84 0.09120521
## 62 2020-02-27 tot_cases 916 998 82 0.08568443
## 63 2020-02-28 tot_cases 968 1049 81 0.08031730
## 64 2020-02-29 tot_cases 1005 1087 82 0.07839388
## 65 2020-03-01 tot_cases 1094 1177 83 0.07309555
## 66 2020-03-02 tot_cases 1172 1254 82 0.06760099
## 67 2020-03-03 tot_cases 1343 1424 81 0.05854716
## 68 2020-03-04 tot_cases 1482 1565 83 0.05447982
## 69 2021-07-05 new_deaths 106 37 69 0.96503497
## 70 2021-07-04 new_deaths 101 38 63 0.90647482
## 71 2021-01-18 new_deaths 2674 1130 1544 0.81177708
## 72 2021-07-03 new_deaths 142 86 56 0.49122807
## 73 2021-01-19 new_deaths 3036 4578 1542 0.40504334
## 74 2020-12-26 new_deaths 2248 3093 845 0.31642015
## 75 2020-12-24 new_deaths 3274 2463 811 0.28272616
## 76 2021-06-27 new_deaths 139 105 34 0.27868852
## 77 2021-06-26 new_deaths 175 142 33 0.20820189
## 78 2021-06-20 new_deaths 177 145 32 0.19875776
## 79 2021-06-19 new_deaths 180 154 26 0.15568862
## 80 2021-06-28 new_deaths 193 170 23 0.12672176
## 81 2021-06-24 new_deaths 287 258 29 0.10642202
## 82 2021-06-17 new_deaths 334 302 32 0.10062893
## 83 2021-06-23 new_deaths 310 281 29 0.09813875
## 84 2021-06-25 new_deaths 300 273 27 0.09424084
## 85 2021-06-22 new_deaths 283 258 25 0.09242144
## 86 2021-06-18 new_deaths 210 192 18 0.08955224
## 87 2021-06-13 new_deaths 200 184 16 0.08333333
## 88 2021-05-30 new_deaths 237 220 17 0.07439825
## 89 2020-03-21 new_deaths 114 107 7 0.06334842
## 90 2021-06-11 new_deaths 326 306 20 0.06329114
## 91 2021-06-16 new_deaths 310 293 17 0.05638474
## 92 2021-06-15 new_deaths 336 319 17 0.05190840
## 93 2020-02-02 new_cases 1 557 556 1.99283154
## 94 2021-07-05 new_cases 11586 3575 8011 1.05679045
## 95 2021-07-04 new_cases 12813 4156 8657 1.02033119
## 96 2021-07-03 new_cases 14988 5887 9101 0.87195210
## 97 2021-06-10 new_cases 16732 12363 4369 0.30032652
## 98 2021-01-18 new_cases 138860 107646 31214 0.25325144
## 99 2021-01-19 new_cases 145017 176292 31275 0.19467242
## 100 2021-07-02 new_cases 16845 14183 2662 0.17158695
## 101 2021-06-20 new_cases 9238 7787 1451 0.17045521
## 102 2020-12-24 new_cases 222830 195402 27428 0.13116165
## 103 2021-06-01 new_cases 9691 8540 1151 0.12626844
## 104 2021-01-29 new_cases 156346 139722 16624 0.11229853
## 105 2020-12-26 new_cases 151877 169350 17473 0.10878911
## 106 2021-06-30 new_cases 17308 15526 1782 0.10854602
## 107 2021-06-28 new_cases 9695 8701 994 0.10806697
## 108 2021-06-09 new_cases 19405 21526 2121 0.10363783
## 109 2021-01-09 new_cases 249814 226455 23359 0.09809162
## 110 2021-01-30 new_cases 137320 150808 13488 0.09362506
## 111 2021-07-01 new_cases 18738 17149 1589 0.08855574
## 112 2021-06-08 new_cases 14357 15667 1310 0.08726352
## 113 2021-06-29 new_cases 16174 15051 1123 0.07192954
## 114 2021-06-06 new_cases 12103 11304 799 0.06827018
## 115 2020-07-14 new_cases 65688 61818 3870 0.06070303
## 116 2021-01-08 new_cases 295299 312357 17058 0.05614361
## 117 2021-05-24 new_cases 15656 14828 828 0.05432358
## 118 2021-05-31 new_cases 9193 9700 507 0.05367067
## 119 2021-05-03 new_cases 33241 31601 1640 0.05058450
## 120 2020-07-15 new_cases 70325 73939 3614 0.05010259
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 IN tot_deaths 3407157 3378244 28913 0.008522120
## 2 SC tot_deaths 2291589 2305862 14273 0.006209093
## 3 CA tot_deaths 14183041 14129523 53518 0.003780512
## 4 NC tot_deaths 3073917 3062861 11056 0.003603194
## 5 MS tot_deaths 1998075 1991323 6752 0.003384972
## 6 KY tot_deaths 1634463 1630052 4411 0.002702392
## 7 AL tot_deaths 2743934 2738028 5906 0.002154703
## 8 RI tot_deaths 749883 751479 1596 0.002126070
## 9 NM tot_deaths 1001515 999916 1599 0.001597857
## 10 CA tot_cases 865747767 837321729 28426038 0.033382123
## 11 AL tot_cases 132184325 131406619 777706 0.005900855
## 12 SC tot_cases 129358076 129977727 619651 0.004778754
## 13 RI tot_cases 32450790 32591078 140288 0.004313775
## 14 MI tot_cases 214132223 214386719 254496 0.001187793
## 15 MS tot_cases 77187328 77104046 83282 0.001079542
## 16 MS new_deaths 7432 7332 100 0.013546464
## 17 NM new_deaths 4382 4344 38 0.008709603
## 18 CA new_deaths 63517 62992 525 0.008299805
## 19 AL new_deaths 11454 11360 94 0.008240554
## 20 KY new_deaths 7285 7229 56 0.007716687
## 21 NC new_deaths 13517 13434 83 0.006159326
## 22 MI new_deaths 21076 20995 81 0.003850633
## 23 IN new_deaths 13914 13863 51 0.003672103
## 24 TX new_deaths 51507 51349 158 0.003072256
## 25 TN new_deaths 12611 12576 35 0.002779211
## 26 WA new_deaths 5954 5939 15 0.002522492
## 27 RI new_deaths 2736 2730 6 0.002195390
## 28 UT new_deaths 2371 2368 3 0.001266090
## 29 CA new_cases 3880232 3713944 166288 0.043793560
## 30 AL new_cases 555727 552325 3402 0.006140506
## 31 VI new_cases 3932 3916 16 0.004077472
## 32 MS new_cases 323003 321780 1223 0.003793524
## 33 LA new_cases 483605 482096 1509 0.003125191
## 34 NV new_cases 335771 334763 1008 0.003006559
## 35 FL new_cases 2344516 2337613 6903 0.002948659
## 36 WY new_cases 62592 62445 147 0.002351304
## 37 UT new_cases 416971 416110 861 0.002067026
## 38 KS new_cases 319154 318515 639 0.002004175
## 39 WA new_cases 453368 452483 885 0.001953964
## 40 AK new_cases 68595 68478 117 0.001707120
## 41 MI new_cases 1002081 1000375 1706 0.001703908
## 42 OR new_cases 209377 209035 342 0.001634752
## 43 NC new_cases 1015407 1014359 1048 0.001032631
##
##
##
## Raw file for cdcDaily:
## Rows: 33,540
## Columns: 15
## $ date <date> 2021-02-12, 2020-07-28, 2020-08-22, 2020-10-22, 2020-0~
## $ state <chr> "UT", "MP", "AR", "MP", "AS", "HI", "AK", "TX", "NYC", ~
## $ tot_cases <dbl> 359641, 40, 56199, 88, 0, 661, 71521, 1867163, 948436, ~
## $ conf_cases <dbl> 359641, 40, NA, 88, NA, NA, NA, NA, 782257, NA, 106, NA~
## $ prob_cases <dbl> 0, 0, NA, 0, NA, NA, NA, NA, 166179, NA, 0, NA, 0, 4003~
## $ new_cases <dbl> 1060, 0, 547, 0, 0, 8, 235, 24010, 394, 18811, 0, 0, 11~
## $ pnew_case <dbl> 0, 0, 0, 0, 0, 0, 0, 4196, 95, 3202, 0, 0, 0, 197, 0, 0~
## $ tot_deaths <dbl> 1785, 2, 674, 2, 0, 17, 377, 33124, 33203, 23357, 2, 0,~
## $ conf_death <dbl> 1729, 2, NA, 2, NA, NA, NA, NA, 28130, NA, 2, NA, NA, 1~
## $ prob_death <dbl> 56, 0, NA, 0, NA, NA, NA, NA, 5073, NA, 0, NA, NA, 350,~
## $ new_deaths <dbl> 11, 0, 11, 0, 0, 0, 0, 345, 6, 190, 0, 0, 7, 8, 5, 0, 1~
## $ pnew_death <dbl> 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, 0, ~
## $ created_at <chr> "02/13/2021 02:50:08 PM", "07/29/2020 02:34:46 PM", "08~
## $ consent_cases <chr> "Agree", "Agree", "Not agree", "Agree", NA, "Not agree"~
## $ consent_deaths <chr> "Agree", "Agree", "Not agree", "Agree", NA, "Not agree"~
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## state = col_character(),
## date = col_date(format = ""),
## geocoded_state = col_logical()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 28
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2021-07-02 hosp_ped 662 597 65 0.10325655
## 2 2021-07-03 hosp_ped 638 597 41 0.06639676
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 AL inp 523814 518483 5331 0.010229330
## 2 TN inp 558512 559654 1142 0.002042631
## 3 NM inp 137802 137991 189 0.001370593
## 4 NH hosp_ped 271 361 90 0.284810127
## 5 ME hosp_ped 452 509 57 0.118626431
## 6 KY hosp_ped 5518 5308 210 0.038795492
## 7 MA hosp_ped 5015 5201 186 0.036413469
## 8 AR hosp_ped 5977 5840 137 0.023186934
## 9 TN hosp_ped 7924 8102 178 0.022213902
## 10 DE hosp_ped 1647 1683 36 0.021621622
## 11 AL hosp_ped 7711 7555 156 0.020437574
## 12 WV hosp_ped 2226 2269 43 0.019132369
## 13 KS hosp_ped 1711 1679 32 0.018879056
## 14 NV hosp_ped 1999 2037 38 0.018830525
## 15 AZ hosp_ped 11435 11266 169 0.014889212
## 16 VA hosp_ped 6604 6513 91 0.013875124
## 17 IN hosp_ped 6913 6826 87 0.012664677
## 18 MS hosp_ped 3727 3686 41 0.011061648
## 19 MO hosp_ped 15406 15241 165 0.010767775
## 20 SC hosp_ped 2706 2679 27 0.010027855
## 21 PA hosp_ped 19857 20010 153 0.007675521
## 22 WA hosp_ped 4288 4263 25 0.005847269
## 23 NM hosp_ped 3125 3107 18 0.005776637
## 24 IA hosp_ped 2275 2287 12 0.005260851
## 25 CO hosp_ped 9355 9401 46 0.004905097
## 26 NJ hosp_ped 9108 9142 34 0.003726027
## 27 OH hosp_ped 25500 25406 94 0.003693081
## 28 IL hosp_ped 19711 19644 67 0.003404904
## 29 GA hosp_ped 21902 21973 71 0.003236467
## 30 MT hosp_ped 1022 1025 3 0.002931119
## 31 PR hosp_ped 11353 11380 27 0.002375401
## 32 CA hosp_ped 30719 30667 52 0.001694197
## 33 LA hosp_ped 3174 3179 5 0.001574059
## 34 TX hosp_ped 38680 38739 59 0.001524174
## 35 FL hosp_ped 54840 54921 81 0.001475934
## 36 HI hosp_ped 720 721 1 0.001387925
## 37 NC hosp_ped 10619 10606 13 0.001224971
## 38 AL hosp_adult 443621 439848 3773 0.008541330
## 39 TN hosp_adult 494022 494969 947 0.001915083
## 40 NM hosp_adult 112634 112842 208 0.001844986
## 41 ME hosp_adult 37173 37121 52 0.001399844
## 42 WV hosp_adult 126618 126444 174 0.001375157
## 43 KY hosp_adult 299353 299757 404 0.001348667
## 44 NH hosp_adult 39064 39014 50 0.001280771
## 45 CA hosp_adult 2422197 2425080 2883 0.001189534
##
##
##
## Raw file for cdcHosp:
## Rows: 27,682
## Columns: 99
## $ state <chr> ~
## $ date <date> ~
## $ critical_staffing_shortage_today_yes <dbl> ~
## $ critical_staffing_shortage_today_no <dbl> ~
## $ critical_staffing_shortage_today_not_reported <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_yes <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_no <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_not_reported <dbl> ~
## $ hospital_onset_covid <dbl> ~
## $ hospital_onset_covid_coverage <dbl> ~
## $ inpatient_beds <dbl> ~
## $ inpatient_beds_coverage <dbl> ~
## $ inpatient_beds_used <dbl> ~
## $ inpatient_beds_used_coverage <dbl> ~
## $ inp <dbl> ~
## $ inpatient_beds_used_covid_coverage <dbl> ~
## $ previous_day_admission_adult_covid_confirmed <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_adult_covid_suspected <dbl> ~
## $ previous_day_admission_adult_covid_suspected_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected_coverage <dbl> ~
## $ staffed_adult_icu_bed_occupancy <dbl> ~
## $ staffed_adult_icu_bed_occupancy_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid_coverage <dbl> ~
## $ hosp_adult <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ hosp_ped <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ total_staffed_adult_icu_beds <dbl> ~
## $ total_staffed_adult_icu_beds_coverage <dbl> ~
## $ inpatient_beds_utilization <dbl> ~
## $ inpatient_beds_utilization_coverage <dbl> ~
## $ inpatient_beds_utilization_numerator <dbl> ~
## $ inpatient_beds_utilization_denominator <dbl> ~
## $ percent_of_inpatients_with_covid <dbl> ~
## $ percent_of_inpatients_with_covid_coverage <dbl> ~
## $ percent_of_inpatients_with_covid_numerator <dbl> ~
## $ percent_of_inpatients_with_covid_denominator <dbl> ~
## $ inpatient_bed_covid_utilization <dbl> ~
## $ inpatient_bed_covid_utilization_coverage <dbl> ~
## $ inpatient_bed_covid_utilization_numerator <dbl> ~
## $ inpatient_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_covid_utilization <dbl> ~
## $ adult_icu_bed_covid_utilization_coverage <dbl> ~
## $ adult_icu_bed_covid_utilization_numerator <dbl> ~
## $ adult_icu_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_utilization <dbl> ~
## $ adult_icu_bed_utilization_coverage <dbl> ~
## $ adult_icu_bed_utilization_numerator <dbl> ~
## $ adult_icu_bed_utilization_denominator <dbl> ~
## $ geocoded_state <lgl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown_coverage <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown_coverage <dbl> ~
## $ deaths_covid <dbl> ~
## $ deaths_covid_coverage <dbl> ~
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## Date = col_character(),
## Location = col_character()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 7
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 1 and at least 1%
##
## [1] date name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
## ***Differences of at least 0 and at least 0.1%
##
## [1] state name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
##
## Raw file for vax:
## Rows: 15,113
## Columns: 69
## $ date <date> 2021-08-03, 2021-08-03, 2021-0~
## $ MMWR_week <dbl> 31, 31, 31, 31, 31, 31, 31, 31,~
## $ state <chr> "MH", "MN", "AL", "MD", "NC", "~
## $ Distributed <dbl> 51300, 6729450, 5167970, 880302~
## $ Distributed_Janssen <dbl> 10800, 349300, 281300, 440400, ~
## $ Distributed_Moderna <dbl> 40500, 2700980, 2377380, 345114~
## $ Distributed_Pfizer <dbl> 0, 3679170, 2509290, 4911480, 6~
## $ Distributed_Unk_Manuf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ Dist_Per_100K <dbl> 87823, 119324, 105400, 145608, ~
## $ Distributed_Per_100k_12Plus <dbl> 102839, 140840, 123432, 170506,~
## $ Distributed_Per_100k_18Plus <dbl> 112755, 155182, 135469, 186861,~
## $ Distributed_Per_100k_65Plus <dbl> 518339, 731158, 608113, 917559,~
## $ vxa <dbl> 36161, 6102310, 3634744, 723766~
## $ Administered_12Plus <dbl> 36132, 6082956, 3634417, 723724~
## $ Administered_18Plus <dbl> 36069, 5709218, 3515687, 675157~
## $ Administered_65Plus <dbl> 2101, 1599519, 1225637, 1686839~
## $ Administered_Janssen <dbl> 1206, 273277, 121830, 277559, 3~
## $ Administered_Moderna <dbl> 34955, 2359899, 1661529, 276459~
## $ Administered_Pfizer <dbl> 0, 3468298, 1851381, 4186640, 5~
## $ Administered_Unk_Manuf <dbl> 0, 836, 4, 8864, 457, 36, 565, ~
## $ Administered_Fed_LTC <dbl> 0, 176248, 90554, 195303, 22810~
## $ Administered_Fed_LTC_Residents <dbl> 0, 73383, 48060, 94356, 112427,~
## $ Administered_Fed_LTC_Staff <dbl> 0, 70268, 32757, 74670, 73173, ~
## $ Administered_Fed_LTC_Unk <dbl> 0, 32597, 9737, 26277, 42502, 2~
## $ Administered_Fed_LTC_Dose1 <dbl> 0, 107732, 55156, 115925, 13667~
## $ Administered_Fed_LTC_Dose1_Residents <dbl> 0, 43418, 28477, 52713, 63620, ~
## $ Administered_Fed_LTC_Dose1_Staff <dbl> 0, 41574, 20542, 43429, 42856, ~
## $ Administered_Fed_LTC_Dose1_Unk <dbl> 0, 22740, 6137, 19783, 30194, 1~
## $ Admin_Per_100k <dbl> 61906, 108204, 74130, 119716, 9~
## $ Admin_Per_100k_12Plus <dbl> 72432, 127309, 86805, 140178, 1~
## $ Admin_Per_100k_18Plus <dbl> 79278, 131656, 92157, 143315, 1~
## $ Admin_Per_100k_65Plus <dbl> 21229, 173789, 144220, 175823, ~
## $ Recip_Administered <dbl> 36214, 6130082, 3736050, 728051~
## $ Administered_Dose1_Recip <dbl> 19994, 3333060, 2154479, 392978~
## $ Administered_Dose1_Pop_Pct <dbl> 34.2, 59.1, 43.9, 65.0, 51.6, 5~
## $ Administered_Dose1_Recip_12Plus <dbl> 19973, 3321978, 2154149, 392930~
## $ Administered_Dose1_Recip_12PlusPop_Pct <dbl> 40.0, 69.5, 51.4, 76.1, 60.1, 6~
## $ Administered_Dose1_Recip_18Plus <dbl> 19925, 3123896, 2075040, 366521~
## $ Administered_Dose1_Recip_18PlusPop_Pct <dbl> 43.8, 72.0, 54.4, 77.8, 62.5, 6~
## $ Administered_Dose1_Recip_65Plus <dbl> 1157, 852313, 690242, 895212, 1~
## $ Administered_Dose1_Recip_65PlusPop_Pct <dbl> 11.7, 92.6, 81.2, 93.3, 84.6, 9~
## $ vxc <dbl> 17307, 3040861, 1693504, 356886~
## $ vxcpoppct <dbl> 29.6, 53.9, 34.5, 59.0, 43.9, 4~
## $ Series_Complete_12Plus <dbl> 17298, 3032831, 1693466, 356870~
## $ Series_Complete_12PlusPop_Pct <dbl> 34.7, 63.5, 40.4, 69.1, 51.2, 5~
## $ vxcgte18 <dbl> 17275, 2858303, 1652134, 335011~
## $ vxcgte18pct <dbl> 38.0, 65.9, 43.3, 71.1, 53.6, 5~
## $ vxcgte65 <dbl> 1008, 801731, 591426, 844755, 1~
## $ vxcgte65pct <dbl> 10.2, 87.1, 69.6, 88.1, 77.2, 8~
## $ Series_Complete_Janssen <dbl> 1199, 274012, 124600, 269678, 3~
## $ Series_Complete_Moderna <dbl> 16097, 1116834, 746560, 1310927~
## $ Series_Complete_Pfizer <dbl> 11, 1649722, 822125, 1985705, 2~
## $ Series_Complete_Unk_Manuf <dbl> 0, 293, 219, 2558, 53, 18, 137,~
## $ Series_Complete_Janssen_12Plus <dbl> 1198, 273993, 124594, 269649, 3~
## $ Series_Complete_Moderna_12Plus <dbl> 16089, 1116822, 746549, 1310893~
## $ Series_Complete_Pfizer_12Plus <dbl> 11, 1641723, 822104, 1985603, 2~
## $ Series_Complete_Unk_Manuf_12Plus <dbl> 0, 293, 219, 2558, 53, 18, 137,~
## $ Series_Complete_Janssen_18Plus <dbl> 1195, 273518, 124535, 269534, 3~
## $ Series_Complete_Moderna_18Plus <dbl> 16071, 1114783, 746285, 1310577~
## $ Series_Complete_Pfizer_18Plus <dbl> 9, 1469720, 781095, 1767515, 23~
## $ Series_Complete_Unk_Manuf_18Plus <dbl> 0, 282, 219, 2485, 52, 18, 120,~
## $ Series_Complete_Janssen_65Plus <dbl> 65, 46101, 32206, 50551, 42106,~
## $ Series_Complete_Moderna_65Plus <dbl> 943, 338638, 312228, 402682, 65~
## $ Series_Complete_Pfizer_65Plus <dbl> 0, 416927, 246854, 390774, 6574~
## $ Series_Complete_Unk_Manuf_65Plus <dbl> 0, 65, 138, 748, 35, 11, 54, 0,~
## $ Series_Complete_FedLTC <dbl> 0, 68296, 35927, 78415, 90579, ~
## $ Series_Complete_FedLTC_Residents <dbl> 0, 29784, 19890, 41147, 47820, ~
## $ Series_Complete_FedLTC_Staff <dbl> 0, 28507, 12335, 30545, 29596, ~
## $ Series_Complete_FedLTC_Unknown <dbl> 0, 10005, 3702, 6723, 13163, 14~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 6
## isType tot_cases tot_deaths new_cases new_deaths n
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.31e+9 1.66e+8 3.51e+7 605510 32981
## 2 after 8.27e+9 1.65e+8 3.49e+7 602741 28509
## 3 pctchg 4.40e-3 3.97e-3 4.59e-3 0.00457 0.136
##
##
## Processed for cdcDaily:
## Rows: 28,509
## Columns: 6
## $ date <date> 2021-02-12, 2020-08-22, 2020-06-05, 2021-07-27, 2021-01-06~
## $ state <chr> "UT", "AR", "HI", "AK", "TX", "TX", "GA", "MA", "OK", "AK",~
## $ tot_cases <dbl> 359641, 56199, 661, 71521, 1867163, 1236648, 493, 662699, 2~
## $ tot_deaths <dbl> 1785, 674, 17, 377, 33124, 23357, 13, 17427, 102, 17, 1331,~
## $ new_cases <dbl> 1060, 547, 8, 235, 24010, 18811, 115, 1598, 96, 29, 89, 870~
## $ new_deaths <dbl> 11, 11, 0, 0, 345, 190, 7, 8, 5, 0, 1, 15, 2, 1, 0, 0, 34, ~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 5
## isType inp hosp_adult hosp_ped n
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 before 2.78e+7 2.19e+7 471723 27682
## 2 after 2.77e+7 2.18e+7 459822 26679
## 3 pctchg 5.58e-3 5.57e-3 0.0252 0.0362
##
##
## Processed for cdcHosp:
## Rows: 26,679
## Columns: 5
## $ date <date> 2020-07-22, 2020-07-20, 2020-07-19, 2020-07-18, 2020-07-18~
## $ state <chr> "IA", "IA", "ND", "IA", "ND", "TX", "OK", "CT", "ND", "NM",~
## $ inp <dbl> 0, 1, 46, 10, 33, 12003, 678, 215, 16, 119, 51, 19, 250, 14~
## $ hosp_adult <dbl> 0, 1, NA, 10, NA, 7999, 566, 115, NA, NA, NA, NA, NA, NA, N~
## $ hosp_ped <dbl> 0, 0, NA, 0, NA, 194, 9, 0, NA, NA, NA, NA, NA, NA, NA, NA,~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 9
## isType vxa vxc vxcpoppct vxcgte65 vxcgte65pct vxcgte18 vxcgte18pct
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.40e+10 3.47e+10 311274. 1.13e+10 575411. 3.38e+10 384223.
## 2 after 4.00e+10 1.68e+10 263386. 5.47e+ 9 524476. 1.63e+10 329394.
## 3 pctchg 5.24e- 1 5.16e- 1 0.154 5.16e- 1 0.0885 5.16e- 1 0.143
## # ... with 1 more variable: n <dbl>
##
##
## Processed for vax:
## Rows: 11,883
## Columns: 9
## $ date <date> 2021-08-03, 2021-08-03, 2021-08-03, 2021-08-03, 2021-08-0~
## $ state <chr> "MN", "AL", "MD", "NC", "SD", "MO", "ND", "NE", "WY", "AZ"~
## $ vxa <dbl> 6102310, 3634744, 7237660, 9776317, 854287, 5503756, 66497~
## $ vxc <dbl> 3040861, 1693504, 3568868, 4606310, 416490, 2549091, 30623~
## $ vxcpoppct <dbl> 53.9, 34.5, 59.0, 43.9, 47.1, 41.5, 40.2, 49.7, 36.7, 45.4~
## $ vxcgte65 <dbl> 801731, 591426, 844755, 1352070, 131441, 792717, 89800, 26~
## $ vxcgte65pct <dbl> 87.1, 69.6, 88.1, 77.2, 86.5, 74.6, 74.9, 85.7, 73.6, 74.5~
## $ vxcgte18 <dbl> 2858303, 1652134, 3350111, 4390894, 400144, 2446269, 29565~
## $ vxcgte18pct <dbl> 65.9, 43.3, 71.1, 53.6, 59.9, 51.3, 50.8, 62.6, 46.2, 55.7~
##
## Integrated per capita data file:
## Rows: 28,722
## Columns: 34
## $ date <date> 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-0~
## $ state <chr> "AL", "HI", "IN", "LA", "MN", "MT", "NC", "TX", "AL", "HI"~
## $ tot_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tot_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ inp <dbl> NA, 0, 0, NA, 0, 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 1877, 0, ~
## $ hosp_adult <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hosp_ped <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxa <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxc <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpoppct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm <dbl> NA, 0.0000, 0.0000, NA, 0.0000, 0.0000, 0.0000, 0.0000, NA~
## $ ahpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ ahpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum unknown in CRS definition
saveToRDS(cdc_daily_210804)
The raw hospital data is explored for admissions with confirmed/suspected coronavirus:
cdcHospAdmit_210804 <- cdc_daily_210804$dfRaw$cdcHosp %>%
select(state, date, ends_with("confirmed"), ends_with("suspected")) %>%
filter(state %in% c(state.abb, "DC")) %>%
arrange(date, state) %>%
pivot_longer(-c(state, date)) %>%
mutate(name=stringr::str_replace(name, pattern="previous_day_admission_", replacement=""),
name=stringr::str_replace(name, pattern="_covid", replacement="")
) %>%
left_join(getStateData(keepVars=c("state", "pop")), by="state") %>%
mutate(vpm=1000000*value/pop) %>%
group_by(state, name) %>%
mutate(vpm7=zoo::rollmean(vpm, k=7, fill=NA)) %>%
ungroup()
cdcHospAdmit_210804 %>%
filter(!is.na(vpm7), state %in% state.abb) %>%
mutate(div=as.character(state.division)[match(state, state.abb)]) %>%
group_by(div, date, name) %>%
summarize(wt_vpm7=sum(pop*vpm7)/sum(pop), tot_pop=sum(pop), .groups="drop") %>%
ggplot(aes(x=date, y=wt_vpm7)) +
geom_col(aes(fill=name), position="stack") +
facet_wrap(~div) +
scale_fill_discrete("Metric") +
labs(x=NULL,
y="Newly admitted for COVID per million (rolling 7-day)",
title="Hospital admissions for COVID",
subtitle="All metrics divided by total population (all ages) for states reporting"
)
Hospital coverage data became robust about a year ago. The overwhelming majority of admissions are adult, split between confirmed and suspected cases. Next steps are to explore changes in admissions by age groups:
hospAge_210804 <- cdc_daily_210804$dfRaw$cdcHosp %>%
select(state,
date,
grep(x=names(.), pattern="ed_\\d.*[9+]$", value=TRUE),
grep(x=names(.), pattern="pediatric.*ed$", value=TRUE)
) %>%
pivot_longer(-c(state, date)) %>%
mutate(confSusp=ifelse(grepl(x=name, pattern="confirmed"), "confirmed", "suspected"),
adultPed=ifelse(grepl(x=name, pattern="adult"), "adult", "ped"),
age=ifelse(adultPed=="ped", "0-17", stringr::str_replace_all(string=name, pattern=".*_", replacement="")),
age=ifelse(age %in% c("0-17", "18-19"), "0-19", age),
div=as.character(state.division)[match(state, state.abb)]
)
hospAge_210804
## # A tibble: 498,276 x 8
## state date name value confSusp adultPed age div
## <chr> <date> <chr> <dbl> <chr> <chr> <chr> <chr>
## 1 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 0-19 <NA>
## 2 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 20-29 <NA>
## 3 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 30-39 <NA>
## 4 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 40-49 <NA>
## 5 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 50-59 <NA>
## 6 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 60-69 <NA>
## 7 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 70-79 <NA>
## 8 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 80+ <NA>
## 9 PR 2020-07-27 previous_day_admission_~ NA suspect~ adult 0-19 <NA>
## 10 PR 2020-07-27 previous_day_admission_~ NA suspect~ adult 20-29 <NA>
## # ... with 498,266 more rows
# Plot for overall trends by age group
p1 <- hospAge_210804 %>%
filter(state %in% c(state.abb, "DC"), !is.na(value)) %>%
mutate(ageBucket=age) %>%
group_by(date, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
arrange(date) %>%
group_by(ageBucket) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
filter(date >= "2020-08-01") %>%
ggplot(aes(x=date, y=value7)) +
labs(x=NULL,
y="Confirmed or suspected COVID admissions (rolling-7 mean)",
title="Hospital admissions for COVID by age bucket (Aug 2020 - Jul 2021)",
subtitle="50 states and DC (includes confirmed and suspected from CDC data)"
) +
lims(y=c(0, NA))
# Line plots by age group
p1 +
geom_line(aes(group=ageBucket, color=ageBucket), size=1) +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 row(s) containing missing values (geom_path).
# Stacked bar plots by age group
p1 +
geom_col(aes(fill=ageBucket), position="stack") +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 rows containing missing values (position_stack).
# Proportions by age group
p1 +
geom_col(aes(fill=ageBucket), position="fill") +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 rows containing missing values (position_stack).
# Plot for overall trends by age group
hospAge_210804 %>%
filter(state %in% state.abb, !is.na(value)) %>%
mutate(ageBucket=ifelse(age >= "60", "60+", ifelse(age=="0-19", "0-19", "20-59"))) %>%
group_by(date, state, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
group_by(ageBucket, state) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
filter(date >= "2020-06-01") %>%
ggplot(aes(x=date, y=value7)) +
geom_line(aes(color=ageBucket, group=ageBucket)) +
scale_color_discrete("Age\nbucket") +
labs(x=NULL,
y="Confirmed or suspected COVID admissions (rolling-7 mean)",
title="Hospital admissions for COVID by age bucket (Aug 2020 - Jul 2021)"
) +
lims(y=c(0, NA)) +
facet_wrap(~state, scales="free_y")
## Warning: Removed 18 row(s) containing missing values (geom_path).
Next steps are to explore alignment of the hospitalization and case/death curves. Michigan having had a distinct spring peak is used as an example:
allHosp_210804 <- hospAge_210804 %>%
mutate(ageBucket=ifelse(age >= "60", "60+", ifelse(age=="0-19", "0-19", "20-59"))) %>%
group_by(date, state, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
group_by(ageBucket, state) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
ungroup() %>%
left_join(getStateData(keepVars=c("state", "pop"))) %>%
mutate(vpm7=1000000*value7/pop)
## Joining, by = "state"
allHosp_210804
## # A tibble: 83,046 x 7
## date state ageBucket value value7 pop vpm7
## <date> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 2020-01-01 AL 0-19 NA NA 4903185 NA
## 2 2020-01-01 AL 20-59 NA NA 4903185 NA
## 3 2020-01-01 AL 60+ NA NA 4903185 NA
## 4 2020-01-01 HI 0-19 NA NA 1415872 NA
## 5 2020-01-01 HI 20-59 NA NA 1415872 NA
## 6 2020-01-01 HI 60+ NA NA 1415872 NA
## 7 2020-01-01 IN 0-19 NA NA 6732219 NA
## 8 2020-01-01 IN 20-59 NA NA 6732219 NA
## 9 2020-01-01 IN 60+ NA NA 6732219 NA
## 10 2020-01-01 LA 0-19 NA NA 4648794 NA
## # ... with 83,036 more rows
allCaseDeath_210804 <- cdc_daily_210804$dfPerCapita %>%
select(state, date, new_cases, new_deaths, vxa, vxc, cpm7, dpm7, vxapm7, vxcpm7) %>%
pivot_longer(-c(state, date))
allCaseDeath_210804
## # A tibble: 229,776 x 4
## state date name value
## <chr> <date> <chr> <dbl>
## 1 AL 2020-01-01 new_cases NA
## 2 AL 2020-01-01 new_deaths NA
## 3 AL 2020-01-01 vxa NA
## 4 AL 2020-01-01 vxc NA
## 5 AL 2020-01-01 cpm7 NA
## 6 AL 2020-01-01 dpm7 NA
## 7 AL 2020-01-01 vxapm7 NA
## 8 AL 2020-01-01 vxcpm7 NA
## 9 HI 2020-01-01 new_cases NA
## 10 HI 2020-01-01 new_deaths NA
## # ... with 229,766 more rows
allPivot_210804 <- allHosp_210804 %>%
select(state, date, name=ageBucket, value=vpm7) %>%
bind_rows(allCaseDeath_210804) %>%
checkUniqueRows(uniqueBy=c("state", "date", "name"))
##
## *** File has been checked for uniqueness by: state date name
allPivot_210804
## # A tibble: 312,822 x 4
## state date name value
## <chr> <date> <chr> <dbl>
## 1 AL 2020-01-01 0-19 NA
## 2 AL 2020-01-01 20-59 NA
## 3 AL 2020-01-01 60+ NA
## 4 HI 2020-01-01 0-19 NA
## 5 HI 2020-01-01 20-59 NA
## 6 HI 2020-01-01 60+ NA
## 7 IN 2020-01-01 0-19 NA
## 8 IN 2020-01-01 20-59 NA
## 9 IN 2020-01-01 60+ NA
## 10 LA 2020-01-01 0-19 NA
## # ... with 312,812 more rows
# Plot Michigan data
typeMapper <- c("cases"="1. Cases per million per day (rolling 7 mean)",
"deaths"="2. Deaths per million per day (rolling 7 mean)",
"hosp"="3. Admitted to hospital per million per day (rolling 7 mean)",
"vax"="4. Vaccinated per capita (administered, completed)"
)
allPivot_210804 %>%
filter(state=="MI", !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
) %>%
filter(plotType != "notuse") %>%
ggplot(aes(x=date, y=value)) +
geom_line(data=~filter(., plotType=="cases"), color="blue", size=1) +
geom_line(data=~filter(., plotType=="deaths"), color="red", size=1) +
geom_line(data=~filter(., plotType=="vax"), aes(color=name, group=name, y=value/1000000)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name), position="stack") +
scale_color_discrete("Vaccine\nMetric") +
scale_fill_discrete("Hospitalized\nby Age") +
facet_wrap(~typeMapper[plotType], scales="free_y") +
labs(x=NULL, y=NULL) +
lims(y=c(0, NA))
hospCase <- 10
allPivot_210804 %>%
filter(state=="MI", !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
) %>%
filter(plotType %in% c("cases", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospCase*value), position="stack") +
geom_line(data=~filter(., plotType=="cases"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Cases per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospCase,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title="Alignment of Michigan cases and hospitalizations data",
subtitle=paste0("Ratio of ",
hospCase,
":1 applied (cases are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
hospDeath <- 0.2
allPivot_210804 %>%
filter(state=="MI", !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
) %>%
filter(plotType %in% c("deaths", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospDeath*value), position="stack") +
geom_line(data=~filter(., plotType=="deaths"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Deaths per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospDeath,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title="Alignment of Michigan deaths and hospitalizations data",
subtitle=paste0("Ratio of ",
hospDeath,
":1 applied (deaths are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
At a glance, the Michigan data appear reasonably well aligned. Hospital admissions run at ~10% of confirmed cases with a small delay. Deaths run at ~20% of hospital admissions in the mid-winter wave and ~10% of admissions in the spring wave. These are consistent with estimates of ~1.5% CFR and ~5 cases per diagnosed cases (fatality rate ~0.3%).
Next steps are to convert this process to functional form, automate selection of scaling parameters, and explore other states of interest:
# Function to create case-hospital-death file
makeCaseHospDeath <- function(dfHosp, dfCaseDeath) {
# FUNCTION ARGUMENTS:
# dfHosp: the tibble or data.frame containing the hospital data by date-state
# dfCaseDeath: the tibble or data.frame containing the case and death data by date-state
allHosp <- dfHosp %>%
mutate(ageBucket=ifelse(age >= "60", "60+", ifelse(age=="0-19", "0-19", "20-59"))) %>%
group_by(date, state, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
group_by(ageBucket, state) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
ungroup() %>%
left_join(getStateData(keepVars=c("state", "pop"))) %>%
mutate(vpm7=1000000*value7/pop)
allCaseDeath <- dfCaseDeath %>%
select(state, date, new_cases, new_deaths, vxa, vxc, cpm7, dpm7, vxapm7, vxcpm7) %>%
pivot_longer(-c(state, date))
allPivot <- allHosp %>%
select(state, date, name=ageBucket, value=vpm7) %>%
bind_rows(allCaseDeath) %>%
checkUniqueRows(uniqueBy=c("state", "date", "name"))
allPivot
}
alignCaseHospDeath <- function(dfPivot=NULL,
dfHosp=NULL,
dfCaseDeath=NULL,
typeMapper=c("cases"="1. Cases per million per day (rolling 7 mean)",
"deaths"="2. Deaths per million per day (rolling 7 mean)",
"hosp"="3. Admitted to hospital per million per day (rolling 7 mean)",
"vax"="4. Vaccinated per capita (administered, completed)"
),
keyState="MI",
hospCaseScalar=10,
hospDeathScalar=0.2,
returnPlots=FALSE
)
{
# FUNCTION ARGUMENTS:
# dfPivot: the tibble or data.frame containing integrated case-hospital-death data
# (if NULL, build from dfHosp and dfCaseDeath)
# dfHosp: the tibble or data.frame containing the hospital data by date-state
# dfCaseDeath: the tibble or data.frame containing the case and death data by date-state
# typeMapper: mapping file for labelling facets
# keyState: the state to explore
# hospCaseScalar: the scalar to be applied for placing cases and hospitalizations on the same plot
# hospDeathScalar: the scalar to be applied for placing hospitalizations and deaths on the same plot
# Create the pivoted data if it was not passed
if (is.null(dfPivot)) {
if (is.null(dfHosp) | is.null(dfCaseDeath)) stop("\nMust pass dfPivot OR both of dfHosp and dfCaseDeath\n")
dfPivot <- makeCaseHospDeath(dfHosp=dfHosp, dfCaseDeath=dfCaseDeath)
}
# Create the plotting data
plotData <- dfPivot %>%
filter(state==keyState, !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
)
# Create overall plot
p1 <- plotData %>%
filter(plotType != "notuse") %>%
ggplot(aes(x=date, y=value)) +
geom_line(data=~filter(., plotType=="cases"), color="blue", size=1) +
geom_line(data=~filter(., plotType=="deaths"), color="red", size=1) +
geom_line(data=~filter(., plotType=="vax"), aes(color=name, group=name, y=value/1000000)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name), position="stack") +
scale_color_discrete("Vaccine\nMetric") +
scale_fill_discrete("Hospitalized\nby Age") +
facet_wrap(~typeMapper[plotType], scales="free_y") +
labs(x=NULL, y=NULL, title=paste0("Key coronavirus metrics for state: ", keyState)) +
lims(y=c(0, NA))
print(p1)
p2 <- plotData %>%
filter(plotType %in% c("cases", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospCaseScalar*value), position="stack") +
geom_line(data=~filter(., plotType=="cases"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Cases per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospCaseScalar,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title=paste0("Alignment of ", keyState, " cases and hospitalizations data"),
subtitle=paste0("Ratio of ",
hospCaseScalar,
":1 applied (cases are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
print(p2)
p3 <- plotData %>%
filter(plotType %in% c("deaths", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospDeathScalar*value), position="stack") +
geom_line(data=~filter(., plotType=="deaths"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Deaths per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospDeathScalar,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title=paste0("Alignment of ", keyState, " deaths and hospitalizations data"),
subtitle=paste0("Ratio of ",
hospDeathScalar,
":1 applied (deaths are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
print(p3)
if(isTRUE(returnPlots)) list(p1=p1, p2=p2, p3=p3)
}
The function is tested for MI, FL, and TX:
dfPivot_210804 <- makeCaseHospDeath(dfHosp=hospAge_210804, dfCaseDeath=cdc_daily_210804$dfPerCapita)
## Joining, by = "state"
##
## *** File has been checked for uniqueness by: state date name
dfPivot_210804
## # A tibble: 312,822 x 4
## state date name value
## <chr> <date> <chr> <dbl>
## 1 AL 2020-01-01 0-19 NA
## 2 AL 2020-01-01 20-59 NA
## 3 AL 2020-01-01 60+ NA
## 4 HI 2020-01-01 0-19 NA
## 5 HI 2020-01-01 20-59 NA
## 6 HI 2020-01-01 60+ NA
## 7 IN 2020-01-01 0-19 NA
## 8 IN 2020-01-01 20-59 NA
## 9 IN 2020-01-01 60+ NA
## 10 LA 2020-01-01 0-19 NA
## # ... with 312,812 more rows
miAlign <- alignCaseHospDeath(dfPivot_210804, keyState="MI", returnPlots=TRUE)
flAlign <- alignCaseHospDeath(dfPivot_210804, keyState="FL", returnPlots=TRUE, hospDeathScalar=0.14)
txAlign <- alignCaseHospDeath(dfPivot_210804, keyState="TX", returnPlots=TRUE, hospDeathScalar=0.14)
# Key plots on a single page
gridExtra::grid.arrange(miAlign$p1, flAlign$p1, txAlign$p1, nrow=2)
gridExtra::grid.arrange(miAlign$p2, flAlign$p2, txAlign$p2, nrow=1)
gridExtra::grid.arrange(miAlign$p3, flAlign$p3, txAlign$p3, nrow=1)
Next, an implied CFR (deaths per case) rate is calculated for inclusion:
# Filter to single-state data
miData <- dfPivot_210804 %>%
filter(state=="MI", name %in% c("cpm7", "dpm7"), !is.na(value))
# Plot core metrics
miData %>%
ggplot(aes(x=date, y=value)) +
geom_line(aes(group=name, color=name)) +
facet_wrap(~c("cpm7"="Cases per million", "dpm7"="Deaths per million")[name], scales="free_y") +
labs(x=NULL, y="Value per million (rolling 7-day mean)", title="Coronavirus burden in state: MI") +
theme(legend.position="none")
# Create correlation for assigned lag/lead and variables in a data frame
lagCorrCheck <- function(df, lagLead=0, varFix="dpm7", varMove="cpm7") {
df %>%
mutate(lagVar=if(lagLead >= 0) lag(get(varMove), lagLead) else lead(get(varMove), abs(lagLead))) %>%
filter(!is.na(lagVar)) %>%
summarize(correl=cor(lagVar, get(varFix))) %>%
pull(correl)
}
miCorrDF <- miData %>%
select(date, name, value) %>%
pivot_wider(date)
miCorrDF
## # A tibble: 553 x 3
## date cpm7 dpm7
## <date> <dbl> <dbl>
## 1 2020-01-25 0 0
## 2 2020-01-26 0 0
## 3 2020-01-27 0 0
## 4 2020-01-28 0 0
## 5 2020-01-29 0 0
## 6 2020-01-30 0 0
## 7 2020-01-31 0 0
## 8 2020-02-01 0 0
## 9 2020-02-02 0 0
## 10 2020-02-03 0 0
## # ... with 543 more rows
# Assessing best lag/lead for full dataset
lagLeads=-10:40
miRhoFull <- tibble::tibble(lagLead=lagLeads,
rho=sapply(lagLeads, FUN=function(x) lagCorrCheck(miCorrDF, lagLead=x))
)
bestFull <- miRhoFull %>% filter(rho==max(rho))
miRhoFull %>%
ggplot(aes(x=lagLead, y=rho)) +
geom_point() +
geom_hline(data=bestFull, aes(yintercept=rho), lty=2) +
geom_vline(data=bestFull, aes(xintercept=lagLead), lty=2) +
labs(x="Lag or lead of cases",
y="Correlation to deaths",
title="All Michigan case and death data",
subtitle=paste0("Best correlation ",
round(bestFull$rho, 3),
" obtained at lag/lead of: ",
bestFull$lagLead
)
)
# Assessing best lag/lead for August 2020 and beyond
lagLeads=-10:40
miRhoLate <- tibble::tibble(lagLead=lagLeads,
rho=sapply(lagLeads,
FUN=function(x) lagCorrCheck(miCorrDF %>% filter(date >= "2020-08-01"),
lagLead=x
)
)
)
bestLate <- miRhoLate %>% filter(rho==max(rho))
miRhoLate %>%
ggplot(aes(x=lagLead, y=rho)) +
geom_point() +
geom_hline(data=bestLate, aes(yintercept=rho), lty=2) +
geom_vline(data=bestLate, aes(xintercept=lagLead), lty=2) +
labs(x="Lag or lead of cases",
y="Correlation to deaths",
title="Michigan case and death data (August 2020 to present)",
subtitle=paste0("Best correlation ",
round(bestLate$rho, 3),
" obtained at lag/lead of: ",
bestLate$lagLead
)
)
miCorrDF %>%
mutate(lag20=lag(cpm7, 20)) %>%
filter(!is.na(lag20), lag20 > 0) %>%
ggplot(aes(x=date)) +
geom_line(aes(y=cpm7), color="navy") +
geom_line(aes(y=lag20), color="navy", lty=2) +
geom_line(aes(y=8000*pmin(0.1, dpm7/lag20)), color="red") +
scale_y_continuous("Cases per million (rolling 7 mean per day) - actual and 20-day lag",
sec.axis = sec_axis(~ . / 8000,
name = "Implied CFR (capped at 10%)"
)
) +
labs(x=NULL, title="Implied case fatality rate using 20-day lag in Michigan")
miCorrDF %>%
mutate(lag20=lag(cpm7, 20)) %>%
filter(!is.na(lag20)) %>%
ggplot(aes(x=date)) +
geom_line(aes(y=cpm7), color="navy") +
geom_line(aes(y=lag20), color="navy", lty=2) +
geom_line(aes(y=50*dpm7), color="red") +
labs(x=NULL,
y="Per million (7-day rolling mean)\nCases, Lag-20 cases, and 50*Deaths",
title="Burden metrics for Michigan"
)
Michigan appears to fairly consistently have a lag of 2-3 weeks between cases and deaths. The CFR during spikes has consistently declined from over 10% to around 2% to around 1%. The estimated CFR outside of spikes appears noisy. Next steps are to convert to functional form and run for other states:
# Create correlation for assigned lag/lead and variables in a data frame
lagCorrCheck <- function(df, lagLead=0, varFix="dpm7", varMove="cpm7") {
df %>%
mutate(lagVar=if(lagLead >= 0) lag(get(varMove), lagLead) else lead(get(varMove), abs(lagLead))) %>%
filter(!is.na(lagVar)) %>%
summarize(correl=cor(lagVar, get(varFix))) %>%
pull(correl)
}
findCorrAlign <- function(df,
keyState,
varFix="dpm7",
varMove="cpm7",
lagLeads=-10:40,
minDate=NULL,
maxDate=NULL,
varMapper=c("cpm7"="Cases per million", "dpm7"="Deaths per million"),
yLab="Value per million (rolling 7-day mean)",
returnData=FALSE
) {
# FUNCTION ARGUMENTS
# df: pivoted data frame with state-date-name-value
# keyState: state to include
# varFix: metric to be held constant
# varMove: metric to be lagged/led
# lagLeads: lags and leads for the variable that moves
# minDate: minimum date for lag/lead (NULL means data-driven)
# maxDate: maximum date for lag/lead (NULL means data-driven)
# varMapper: mapping file for varFix and varMove to descriptive labels
# yLab: label for the y-axis in the first plot
# returnData: boolean, should the data frames be returned as a list?
# Set minDate and maxDate to the actual minmax if passed as NULL
if (is.null(minDate)) minDate <- df %>% summarize(date=min(date)) %>% pull(date)
if (is.null(maxDate)) maxDate <- df %>% summarize(date=max(date)) %>% pull(date)
# Filter to relevant data
df <- df %>%
filter(state %in% all_of(keyState), name %in% all_of(c(varFix, varMove)), !is.na(value))
# Plot core metrics for requested states
p1 <- df %>%
ggplot(aes(x=date, y=value)) +
geom_line(aes(group=name, color=name)) +
facet_wrap(~varMapper[name], scales="free_y") +
labs(x=NULL, y=yLab, title=paste0("Metrics by state for: ", paste0(keyState, collapse=", "))) +
theme(legend.position="none")
print(p1)
# Create dataset for correlations
dfCorr <- df %>%
select(date, name, value) %>%
pivot_wider(date)
# Find correlation by lag/lead for dataset
dfRho <- tibble::tibble(lagLead=lagLeads,
rho=sapply(lagLeads,
FUN=function(x) {
lagCorrCheck(dfCorr %>% filter(date >= minDate, date <= maxDate),
lagLead=x
)
}
)
)
# Find best correlation and lag/lead
bestRho <- dfRho %>%
filter(rho==max(rho))
# Plot correlations by lag/lead
p2 <- dfRho %>%
ggplot(aes(x=lagLead, y=rho)) +
geom_point() +
geom_hline(data=bestRho, aes(yintercept=rho), lty=2) +
geom_vline(data=bestRho, aes(xintercept=lagLead), lty=2) +
labs(x=paste0("Lag or lead of ", varMapper[varMove]),
y=paste0("Correlation to ", varMapper[varFix]),
title=paste0("Correlations by lag/lead for state: ", keyState),
subtitle=paste0("Best correlation ",
round(bestRho$rho, 3),
" obtained at lag/lead of: ",
bestRho$lagLead
)
)
print(p2)
if (returnData) list(dfRho=dfRho, bestRho=bestRho, dfCorr=dfCorr)
}
findCorrAlign(dfPivot_210804, keyState="MI")
findCorrAlign(dfPivot_210804, keyState="MI", minDate="2020-08-01", returnData=TRUE)
## $dfRho
## # A tibble: 51 x 2
## lagLead rho
## <int> <dbl>
## 1 -10 0.320
## 2 -9 0.348
## 3 -8 0.376
## 4 -7 0.404
## 5 -6 0.432
## 6 -5 0.460
## 7 -4 0.488
## 8 -3 0.515
## 9 -2 0.543
## 10 -1 0.570
## # ... with 41 more rows
##
## $bestRho
## # A tibble: 1 x 2
## lagLead rho
## <int> <dbl>
## 1 20 0.880
##
## $dfCorr
## # A tibble: 553 x 3
## date cpm7 dpm7
## <date> <dbl> <dbl>
## 1 2020-01-25 0 0
## 2 2020-01-26 0 0
## 3 2020-01-27 0 0
## 4 2020-01-28 0 0
## 5 2020-01-29 0 0
## 6 2020-01-30 0 0
## 7 2020-01-31 0 0
## 8 2020-02-01 0 0
## 9 2020-02-02 0 0
## 10 2020-02-03 0 0
## # ... with 543 more rows
findCorrAlign(dfPivot_210804, keyState="FL")
findCorrAlign(dfPivot_210804, keyState="TX", minDate="2020-10-01")
Next steps are to create functional form for calculating IFR and aligning plots.